#include <stdio.h>
#include <string.h>
#include "teacher.h"
int sort_by_id(p_teacher left,p_teacher right)
{
	if(left->id > right->id)
	{
		return 1;
	}
	return 0;
}
int main(void)
{
	/* 初始化临时变量  */
	teacher t1 = {1,"\0","\0"};
	/* 添加一个 */
	t1.id = 1;
	strcpy(t1.name,"jin1");
	strcpy(t1.subject,"math");
	push(&t1);
	printf("\n******** push ***********\n");
	print_all();
	
	/* 添加一个 */
	t1.id = 2;
	strcpy(t1.name,"jin2");
	strcpy(t1.subject,"english");
	push(&t1);
	printf("\n******** push ***********\n");
	print_all();
	
	/* 往指定位置插入一个 */
	t1.id = 3;
	strcpy(t1.name,"jin3");
	strcpy(t1.subject,"php");
	insert(&t1,0);
	printf("\n******** insert **********\n");
	print_all();
	
	/* 删除指定位置的数据 */
	delete_by_index(1);
	printf("\n******** delete_by_index ***********\n");
	print_all();
	
	/* 根据传入的排序函数对数据进行排序 */
	int (*compare)(p_teacher,p_teacher) = sort_by_id;
	sort(compare);
	printf("\n******** sort_by_index ***********\n");
	print_all();
	return 0;
}
